__________________________________________________________________________________________________
class Solution {
public:
  int calculateTime(string keyboard, string word) {
    vector<int> pos(26);
    for(int i=0;i<26;i++) pos[keyboard[i]-'a']=i;
    int cur=0,res=0;
    for(char c:word){
      int dif=abs(cur-pos[c-'a']);
      res+=dif;
      cur=pos[c-'a'];
    }
    return res;
  }
};
__________________________________________________________________________________________________

__________________________________________________________________________________________________
